import os

from llama_index.core import Settings, SimpleDirectoryReader, VectorStoreIndex
from llama_index.embeddings.dashscope import DashScopeEmbedding, DashScopeTextEmbeddingModels
from llama_index.llms.dashscope import DashScope, DashScopeGenerationModels

# 配置大模型
Settings.llm = DashScope(model_name=DashScopeGenerationModels.QWEN_PLUS, api_key=os.getenv("DASHSCOPE_API_KEY"))
# 配置向量模型
Settings.embed_model = DashScopeEmbedding(model_name=DashScopeTextEmbeddingModels.TEXT_EMBEDDING_V1,
                                          api_key=os.getenv("DASHSCOPE_API_KEY"))

# 加载本地文件
documents = SimpleDirectoryReader("./data").load_data()
print(documents)

# index = VectorStoreIndex.from_documents(documents)
#
# query_engine = index.as_query_engine()
# response = query_engine.query("DeepSeek-V3 有多少参数?")
# print(response)
